package com.trace.controller;

import com.alibaba.fastjson.JSONObject;
import com.rlyy.common.param.Request;
import com.rlyy.common.response.Result;
import com.rlyy.grpc.client.GrpcClientServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.concurrent.Executor;
import java.util.concurrent.Executors;

/**
 * @author yuanqinglong
 * @since 2021/10/13 9:32
 */
@RestController
public class AController {
    //
    //
    //@Autowired
    ////private GrpcClientServer grpcClientServer;
    //private UserClientServer userClientServer;
    //
    //
    //@RequestMapping("trace2")
    //public Result test(Request request) {
    //    Request r = new Request();
    //    r.setApiId("trace3");
    //    Result result = userClientServer.userAdd("1");
    //    //if (true){
    //    //    throw new BusinessException("ssss");
    //    //}
    //    return new Result();
    //}
    //
    //private static Executor executor = Executors.newFixedThreadPool(5, Executors.defaultThreadFactory());

    public static void main(String[] args) {

        String s1 = new StringBuilder("test111113").append("3").toString();
        String s1Intern = s1.intern();
        System.out.println("s1==s1Intern:" +(s1 == s1Intern));
        String s2 = new StringBuilder("test111113").append("3").toString();
        String s2Intern = s2.intern();
        System.out.println("s2==s2Intern:"+(s2 == s2Intern));
        System.out.println();
        System.out.println("s1==s2Intern:"+(s1==s2Intern));
        //执行完上面字符串常量池中还是不存在“test1111133” 存的是s1在堆中的引用
        String s0 = "test1111133"; // “test1111133”在常量池中已经有一份堆中的引用了 直接用堆中的地址 还是s1
        System.out.println("s0==s2Intern:"+(s0==s2Intern));


    }
}
